package com.yb.sys.user.controller;

import com.yb.core.bean.Resp;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2022, 姚兵
 * Author: 32210
 * Date: 2022/11/13 21:09
 * FileName: HelloController
 * Description:
 */

@RestController
public class HelloController {

    @RequestMapping("/users")
    @PreAuthorize("hasAuthority('ROLE_ADMIN')")
    public Resp users(){
        return Resp.ok().data("users");
    }

    @RequestMapping("demo")
    public Resp demo(){
        return Resp.ok().data("demo");
    }

    @RequestMapping("/admin")
    @PreAuthorize("hasAuthority('ADMIN')")
    public Resp admin(){
        return Resp.ok().data("admin");
    }
}
